﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;

namespace LX.Core.Cryptography
{
    public class MD5
    {
        public static string Encrypt(string encryptString)
        {
            //创建MD5密码服务提供程序
            var md5 = new MD5CryptoServiceProvider();

            //获取加密字符串
            string result = BitConverter.ToString(md5.ComputeHash(System.Text.UTF8Encoding.Default.GetBytes(encryptString)));

            //释放资源
            md5.Clear();

            //返回MD5值的字符串表示
            return result.Replace("-", "");
        }
    }
}
